<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改产品销量纪录')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-partsRebate-edit" th:object="${zsyhPartsRebate}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">厂家名称：</label>
                <div class="col-sm-8">
                    <input name="factoryName" th:field="*{factoryName}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">产品名称：</label>
                <div class="col-sm-8">
                    <input name="partsName" th:field="*{partsName}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">规格名称：</label>
                <div class="col-sm-8">
                    <input name="attributeName" th:field="*{attributeName}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">核算销量/销售额：</label>
                <div class="col-sm-8">
                    <input id="rebateNumber" name="rebateNumber" th:field="*{rebateNumber}" class="form-control"  onchange="updateMoney();" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">核算单价：</label>
                <div class="col-sm-8">
                    <input id="rebatePrice" name="rebatePrice" th:field="*{rebatePrice}" class="form-control" onchange="updateMoney();" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">核算服务费：</label>
                <div class="col-sm-8">
                    <input id="rebateMoney" name="rebateMoney" th:field="*{rebateMoney}" class="form-control" type="text" readonly required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea id="rebateRemark" name="rebateRemark" th:field="*{rebateRemark}" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "zsyh/partsRebate";
        $("#form-partsRebate-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-partsRebate-edit').serialize());
            }
        }

        function updateMoney() {
            debugger;
            var totalMoney=0;
            if(($("#rebateNumber").val() != '' && $("#rebateNumber").val() != null && $("#rebateNumber").val() != undefined) && ($("#rebatePrice").val() != '' && $("#rebatePrice").val() != null && $("#rebatePrice").val() != undefined)){
                totalMoney =($("#rebateNumber").val() * $("#rebatePrice").val() ).toFixed(2);
                $("#rebateMoney").val(totalMoney);
            }

        }

    </script>
</body>
</html>